const { v1: uuid } = require('uuid');
const log = require('../lib/log');

/**
 * 日志中间件
 * @param {import('socket.io').Server} socket 
 * @param {*} next 
 */
module.exports = async function (socket, next) {
  socket.traceId = uuid();
  log.request.info(`package [${ socket.traceId }] ${ socket.type }`);
  await next();
  // socket 断开连接
};